<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
	<base href="<%=basePath%>" />
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>用户登录</title>
	<link href="res/login/styles.css" type="text/css" media="screen" rel="stylesheet">
    <link href="res/login/jquery-ui-1.8.16.custom.css" rel="stylesheet">
    <script src="res/js/jquery-2.1.4.min.js"></script>
    <link type="text/css" href="res/login/keyboard.css" rel="stylesheet">
    
	</head>
	<body id="login">
		<div id="wrappertop"></div>
		<div id="wrapper">
			<div id="content">
				<div id="header">
					
				</div>
				<div id="darkbanner" class="banner320">
					<h2>系统登录</h2>
				</div>
				<div id="darkbannerwrap"></div>
				<form id="form1" name="form1" method="post">
					<fieldset class="form">
						<p>
							<label class="loginlabel" for="user_name"> 用户名:</label> <input
								class="logininput ui-keyboard-input ui-widget-content ui-corner-all"
								name="staffAccount" id="staffAccount" type="text" value="">
						</p>
						<p>
							<label class="loginlabel" for="user_password"> 密码:</label> <span>
								<input
								class="logininput ui-keyboard-input ui-widget-content ui-corner-all"
								name="staffPwd" id="staffPwd" type="password"
								aria-haspopup="true" role="textbox">
							</span>
						</p>
						<button id="loginbtn" type="button" class="positive" name="Submit">
							<img src="res/login/key.png" alt="Announcement">登录
						</button>
						<ul id="forgottenpassword">
	                    <!-- <li class="boldtext">|</li>
	                    <li style="color: red;">
	                    	
                        </li> -->
               			 </ul>
					</fieldset>
				</form>
			</div>
		</div>
		<div id="wrapperbottom_branding">
			<div id="wrapperbottom_branding_text">
				
			</div>
		</div>
		<script type="text/javascript">
			//staff/validateLogin.action
			
			$(".logininput").blur(function() {
	            if ($(this).val() == "") {
	                $(this).css("border-color", "red");
	            }else{
	                $(this).css("border-color", "#D9D6C4");
	            }
            })
			
			$("#loginbtn").click(function() {
                var k = 0;
                var ajaxhtml = "";
                $(".logininput").each(function(i, obj) {
                    if ($(obj).val().trim() == "") {
                        k++;
                        $(this).css("border-color", "red");
                        $(this).focus();
                        return false;
                    }
                });
                if (k != 0) return;
                ajaxhtml = $("#loginbtn").html();
                $("#loginbtn").html("Loading....  <img src='res/login/loading.gif' alt='Announcement' /> ");
                $("#loginbtn").attr("disabled", "disabled");
                
                var url = "staff/isLogin.action";
                var data = $("#form1").serialize();
                $.post(url, data, function (info){
                	if(info.state==1){
                		location.href="pages/index.jsp"; 
                	}else{
                		$(".logininput").css("border-color", "red");
                		$("#loginbtn").removeAttr("disabled");
                		$("#loginbtn").html(ajaxhtml);
                	}
                });
                
            })
	    </script>
	</body>
</html>